-
-
Notifications
You must be signed in to change notification settings - Fork 442
Fix shell plugin focus issue #3987
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a shell plugin focus issue by implementing a more robust window focus mechanism and increasing delay timing. The changes address Windows' interference with Win+R keyboard shortcuts that were preventing proper focus restoration.
- Increased Task.Delay from 50ms to 1000ms to better handle Windows' Win+R processing
- Added a new
BringToForegroundEx
method that uses multiple Win32 APIs for reliable window focusing - Enhanced the focus mechanism to call the new method before setting text box focus
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
Main.cs | Increased delay timing for Win+R handling from 50ms to 1000ms |
MainViewModel.cs | Added call to new BringToForegroundEx method before focusing text box |
Win32Helper.cs | Implemented comprehensive BringToForegroundEx method using Win32 APIs |
NativeMethods.txt | Added required Win32 API method declarations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
await Task.Delay(1000); | ||
Context.API.FocusQueryTextBox(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The delay has been increased from 50ms to 1000ms, which is a 20x increase. This significantly impacts user experience by making the application feel unresponsive. Consider a more moderate increase (e.g., 100-200ms) or implement a retry mechanism with shorter delays.
await Task.Delay(1000); | |
Context.API.FocusQueryTextBox(); | |
// Try to set focus up to 4 times with 50ms intervals (max 200ms) | |
for (int i = 0; i < 4; i++) | |
{ | |
await Task.Delay(50); | |
Context.API.FocusQueryTextBox(); | |
} |
Copilot uses AI. Check for mistakes.
Cannot work |
Tried to fix issue 1945